/*
 * Copyright 2017-8-30 13:56:26 The JA-SIG Collaborative. All rights reserved.
 * distributed with thi file and available online at
 */
package com.lap.scp.admin.controller;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import com.lap.scd.commons.page.Page;
import com.lap.scd.commons.page.PageResult;
import com.lap.scd.commons.result.Resp;
import com.lap.scp.admin.ao.AccessLogsAO;
import com.lap.scp.admin.domain.AccessLogsDO;
import com.lap.scp.admin.query.AccessLogsQueryDO;

/**
 * <pre>
 * 日志访问控制层
 * </pre>
 * 
 * @author 系统自动生成 Exp
 * @Date 2017-8-30 13:56:26
 * @since 1.0
 */
@Controller
@RequestMapping("accessLogs")
public class AccessLogsController {

	@Resource
	private AccessLogsAO accessLogsAO;

	@RequestMapping(value = "delete/{accessLogsId}", method = { RequestMethod.GET, RequestMethod.POST })
	public ModelAndView deleteById(@PathVariable int accessLogsId) {
		ModelAndView andView = new ModelAndView("redirect:/accessLogs/list");
		Resp<Integer> result = accessLogsAO.deleteById(accessLogsId);
		if (!result.isSuccess()) {
			//
		}
		return andView;
	}

	@RequestMapping(value = "list", method = { RequestMethod.GET, RequestMethod.POST })
	public ModelAndView queryPage(Page page, AccessLogsQueryDO accessLogsDO) {
		ModelAndView andView = new ModelAndView("admin/accessLogsList");
		PageResult<AccessLogsDO> pr = accessLogsAO.queryPage(page, accessLogsDO);
		andView.addObject("pr", pr);
		andView.addObject("accessLogsDO", accessLogsDO);
		return andView;
	}

}
